<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>浏览器尺寸，小于500的时候，背景变成红色</h1>
    <style>
        .big,.small{
            display: none;
        }
        /* and后有空格 */
        @media only screen and (max-width:500px) {
            body{
                background-color: red;
            }
            .small{
                display: block;
            }
        }
        @media only screen and (min-width:501px) {
            body{
                background-color: blue;
            }
            .big{
                display: block;
            }
        }
    </style>
    <p class="big">这是大屏，电脑</p>
    <p class="small">这是小屏，手机</p>
</body>
</html>